<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function my_new_Object() {
            let newObject = null;
            let constructor = Array.prototype.shift.call(arguments)
            let result = null

            if (typeof constructor !== "function") {
                console.log("Error");
                return;
            }

            newObject = Object.create(constructor.prototype)

            result = constructor.apply(newObject,arguments);

            let flag = result && (typeof result === "object" ||typeof result=== "function")
            return flag?result:newObject;


        }
    </script>
</body>

</html>